﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SharePointLogBrowser2
{
    public class LogItem
    {
        public LogItem()
        {
            
        }

        public LogItem(string line)
        {
            string[] parts = line.Split('\t');

            TimeStamp = GetPart(parts, 0);
            Process = GetPart(parts, 1);
            TID = GetPart(parts, 2);
            Area = GetPart(parts, 3);
            Category = GetPart(parts, 4);
            EventID = GetPart(parts, 5);
            Level = GetPart(parts, 6);
            Message = GetPart(parts, 7);
            Correlation = GetPart(parts, 8);
        }

        private static string GetPart(string[] parts, int index)
        {
            if (parts.Length > 0)
            {
                string part = parts[index];
                if (part != null)
                {
                    return part.Trim();
                }
            }
            return null;
        }

        public string TimeStamp { get; set; }
        public string Process { get; set; }
        public string TID { get; set; }
        public string Area { get; set; }
        public string Category { get; set; }
        public string EventID { get; set; }
        public string Level { get; set; }
        public string Message { get; set; }
        public string Correlation { get; set; }
    }
}
